#ifndef __TRIMESH_H__
#define __TRIMESH_H__

#include "Geometry.h"

class TriMesh : public Geometry
{
public:
	TriMesh( unsigned int num_vertices, Vector3* vertex,
		Vector3* normal, Color* color, Vector2* texture,
		unsigned int num_triangles, unsigned int* connect );

	virtual ~TriMesh();

	void reconstruct( unsigned int num_vertices, unsigned int num_triangles );

	void reconstruct( unsigned int num_vertices, Vector3* vertex,
		Vector3* normal, Color* color, Vector2* texture, unsigned int num_triangles,
		unsigned int* connect );

	// connectivity access
	unsigned int* connectivity();
	const unsigned int* connectivity() const;

	// triangle access
	unsigned int get_num_triangle() const;
	void get_triangle( unsigned int i, unsigned int& v0,
		unsigned int& v1, unsigned int& v2 ) const;
	void get_triangle( unsigned int i, Vector3& v0, Vector3& v1,
		Vector3& v2 ) const;

	// updates
	virtual void update_model_normals();

protected:
	TriMesh();

	//drawing
	virtual void draw( Renderer& renderer );

	//triangles
	unsigned int m_num_triangles;
	unsigned int *m_connect;
};

#include "TriMesh.inl"

#endif


